<script lang="ts" setup>
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import { defineComponent, getCurrentInstance, onMounted } from '@vue/runtime-core'
import { Toast } from 'vant'
import { useRouter } from 'vue-router'
import GlobalApi from './api/global'

const { proxy } = getCurrentInstance()
proxy.$toast = Toast;
proxy.$router = useRouter();
const toIndex = () => {
  proxy.$router.push('/')
}
const toMy = () => {
  proxy.$router.push('/my')
}
onMounted(() => {
  proxy.$api = GlobalApi();
  window.ZWJSBridge.onReady(() => {
    console.log('浙里办jsbradge初始化成功')
    proxy.$zlb = window.ZWJSBridge
    // window.ZWJSBridge.zmAuthentication({
    //   })
    //     .then((data) => {
    //     // data=> {"pass" : true,
    //     // "passId" : "xxxxx"}
    // }).catch((error) => {
    //     console.log(error);
    // });
  })
})
</script>

<template>
  <div>
    <router-view />
    <van-tabbar v-model="active">
      <van-tabbar-item
        icon="home-o"
        @click="toIndex"
      >
        首页
      </van-tabbar-item>
      <van-tabbar-item
        icon="user-o"
        @click="toMy"
      >
        我的
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<style>
*{
  box-sizing: border-box;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
body {
  margin: 0 !important;
}
</style>
